<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="<%=basePath %>/resource/js/common-css-js.js"></script>
<title>货物清单-修改货物</title>
</head>
<body>
	<div class="panel-body" style="padding-bottom:0px;">
		<form class="layui-form">
		  <input type="hidden" name="goodsListProductId" />
		  <div class="layui-form-item">
			  <input type="text" name="goodsListProductName" lay-verify="required" placeholder="货物名称" autocomplete="off" class="layui-input">
		  </div>
		  <div class="layui-form-item">
		      <input type="text" name="goodsListProductAmount" lay-verify="required|number" placeholder="货物数量" autocomplete="off" class="layui-input">
		  </div>
		  <div class="layui-form-item">
		      <input type="text" name="goodsListProductUnit" lay-verify="required" placeholder="货物单位" autocomplete="off" class="layui-input">
		  </div>
		  <div class="layui-form-item">
		      <input type="text" name="goodsListUpLimit" lay-verify="required" placeholder="货物充足界限" autocomplete="off" class="layui-input">
		  </div>
		  <div class="layui-form-item">
		      <input type="text" name="goodsListLowLimit" lay-verify="required" placeholder="货物不足界限" autocomplete="off" class="layui-input">
		  </div>
		  <div class="layui-form-item">
		      <input type="text" id="goodsListInStockTime" lay-verify="required" name="goodsListInStockTime" placeholder="入库时间" autocomplete="off" class="layui-input">
		  </div>
		  <div class="layui-form-item">
		    <select name="goodsListProductClass" lay-verify="required">
		    </select>
      	  </div>
		  <div class="layui-form-item">
		    <select id="goodsListStorageId" name="goodsListStorageId" lay-verify="required">
		    </select>
      	  </div>
		  <%@include file="/admin/commonsPage/submit-reset.html" %>
		</form>
	</div>
	<script type="text/javascript">
	
		var storageEle = $("[name='goodsListStorageId']");
		var storagePositionData = parent.storagePosition;
		
		//获取选中表格
		var selectedData = parent.cTable.bootstrapTable('getSelections');
	
		laydate.render({ 
		  elem: '#goodsListInStockTime'
		  ,type: 'datetime'
		});
		
		//回现数据
		for (key in selectedData[0]){
			$("input[name='"+key+"']").val(selectedData[0][key]);
		}
		
		for(var i = 0;i<storagePositionData.length;i++){
			
			if(storagePositionData[i].stgPosId == selectedData[0].goodsListStorageId){
				storageEle.append("<option selected value='"+ storagePositionData[i].stgPosId +"'>" 
						+ storagePositionData[i].stgPosMark + "-" + storagePositionData[i].stgPosNature + "-" + storagePositionData[i].stgPosStatus +"</option>");
			}else{
				storageEle.append("<option value='"+ storagePositionData[i].stgPosId +"'>" 
						+ storagePositionData[i].stgPosMark + "-" + storagePositionData[i].stgPosNature + "-" + storagePositionData[i].stgPosStatus +"</option>");
			}
			
		}
		
		//回现库存状态
		$("[name='goodsListNumberState']>[value='"+selectedData[0].goodsListNumberState+"']").attr("selected",true);
		
		renderSelectedOption($("[name='goodsListProductClass']"),parent.productClass,selectedData[0].goodsListProductClass);
		
		requestUpdateData("/repository/goods-list");
	</script>
</body>
</html>